package com.hbrj.service;

import com.hbrj.entity.Student;
import com.hbrj.mapper.StudentMapper;
import org.apache.catalina.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StudentService {
    @Resource
    private StudentMapper studentMapper;
    //查询所有学生信息
    public List<User> selectAll(){
        return studentMapper.selectAll();
    }
    //查询指定学生信息
    public Student select(String name){
        studentMapper.selectByName(name);
        return studentMapper.selectByName(name);
    }
    //增加学生信息
    public void insert(){
        Student student=new Student();
        studentMapper.insert(student);
    }
    //更新学生信息
    public void update(String name,String grade){
        studentMapper.updateByGrade(name,grade);

    }
    //删除学生信息
    public void delete(int id){
        studentMapper.deleteByPrimaryKey(id);
    }
}
